<%@ page import="java.util.Date" %><%--
  Created by IntelliJ IDEA.
  User: dailyblue
  Date: 2023/4/2
  Time: 14:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" language="java" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>格式化标签</title>
</head>
<body>
<%--设置请求的编码集--%>
<%
    //request.setCharacterEncoding("utf-8");
%>
<fmt:requestEncoding value="utf-8"/>
<%--格式化数字--%>
<h3>未格式化</h3>
${10/3}<br/>
${5/4}<br/>
<hr/>
<h3>格式化</h3>
<fmt:formatNumber pattern="##.##" value="${10/3}" var="num1" scope="page"/>
<fmt:formatNumber pattern="##.##" value="${10000/3}" var="num2" scope="page"/>
<fmt:formatNumber pattern="00.00" value="${10000/3}" var="num3" scope="page"/>
${num1}<br/>
${num2}<br/>
${num3}<br/>
<hr/>
<%--格式化时间--%>
未格式化：<%=new Date()%><br/>
<fmt:formatDate value="<%=new Date()%>" pattern="yyyy-MM-dd HH:mm:ss" var="date1" scope="request"/>
格式化后：${date1}
</body>
</html>
